﻿#region File and License Information
/*
<File>
	<License>
		Copyright © 2009 - 2017, Daniel Vaughan. All rights reserved.
		This file is part of Calcium (http://calciumsdk.net), 
		which is released under the MIT License.
		See file /Documentation/License.txt for details.
	</License>
	<CreationDate>2013-01-01 11:36:50Z</CreationDate>
</File>
*/
#endregion

namespace Outcoder.Messaging
{
	public abstract class CancellableMessageBase<TPayload>
		: PayloadMessageBase<TPayload> //where TPayload : class
	{
		protected CancellableMessageBase(object sender, TPayload payload)
			: base(payload)
		{
			Sender = ArgumentValidator.AssertNotNull(sender, "sender");
		}

		public object Sender { get; private set; }

		bool cancel;

		public bool Cancel
		{
			get
			{
				return cancel;
			}
			set
			{
				if (cancel)
				{
					return;
				}
				cancel = value;
			}
		}
	}

	public abstract class CancellableMessageBase
	{
		protected CancellableMessageBase()
		{
		}

		bool cancel;

		public bool Cancel
		{
			get
			{
				return cancel;
			}
			set
			{
				if (cancel)
				{
					return;
				}
				cancel = value;
			}
		}
	}
}